package duotai;

class Shape {

	public void draw() {
		System.out.println("画图形！");
	}
}
class Rect extends Shape {
	@Override
	public void draw() {
		System.out.println("矩形");
	}
}
class Cycle extends Shape {
	@Override
	public void draw() {
		System.out.println("圆");
	}
}

class Flower extends Shape {
	@Override
	public void draw() {
		System.out.println("❀");
	}
}
public class test {
	public static void drawMaps1() {
		Rect rect =new Rect();
		Cycle cycle =new Cycle();
		Flower flower =new Flower();
		Shape[] shapes={rect,cycle,flower};//这里发生向上转型
		for(Shape shape:shapes) {
			shape.draw();
		}
	}
	public static void main(String[] args) {
		drawMaps1();
	}

}
